package iteratorPattern;

import java.util.ArrayList;
import java.util.List;

public class BookCollection implements Aggregate {

    private List<String> books=null;

    public BookCollection(){
        books=new ArrayList<String>();
    }

    public BookCollection(List<String> books) {
        this.books=books;
    }

    public void addBook(String book){
        books.add(book);
    }

    @Override
    public Iterator createIterator() {
        return new BookIterator(books);
    }
}
